package com.xy.biz.rs.domain.converter;

import java.util.Collection;
import java.util.List;

import com.xy.biz.rs.domain.req.UpdateManufactureRecordTemplateRequestStatus;
import com.xy.tool.util.BeanUtilsEx;
import com.xy.biz.rs.domain.bo.ManufactureRecordTemplateBO;
import com.xy.biz.rs.domain.po.ManufactureRecordTemplatePO;
import com.xy.biz.rs.domain.query.ManufactureRecordTemplateQuery;
import com.xy.biz.rs.domain.resp.GetManufactureRecordTemplateResponse;
import com.xy.biz.rs.domain.req.SaveManufactureRecordTemplateRequest;
import com.xy.biz.rs.domain.req.ListManufactureRecordTemplateRequest;

/**
 *
 *
 * @author zsp
 * @date 2021-4-13
 */
public class ManufactureRecordTemplateConverter {

	public static ManufactureRecordTemplatePO toPO(ManufactureRecordTemplateBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new ManufactureRecordTemplatePO(), true);
	}

	public static List<ManufactureRecordTemplatePO> toPO(Collection<ManufactureRecordTemplateBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new ManufactureRecordTemplatePO(), true);
	}

	public static ManufactureRecordTemplateBO fromPO(ManufactureRecordTemplatePO source) {
		return BeanUtilsEx.copyProperties(source, () -> new ManufactureRecordTemplateBO());
	}

	public static List<ManufactureRecordTemplateBO> fromPO(Collection<ManufactureRecordTemplatePO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new ManufactureRecordTemplateBO());
	}

	public static ManufactureRecordTemplateBO toBO(SaveManufactureRecordTemplateRequest source) {
		return BeanUtilsEx.copyProperties(source, () -> new ManufactureRecordTemplateBO(), true);
	}

	public static ManufactureRecordTemplateBO toBO(UpdateManufactureRecordTemplateRequestStatus source) {
		return BeanUtilsEx.copyProperties(source, () -> new ManufactureRecordTemplateBO(), true);
	}

	public static ManufactureRecordTemplateBO toBO(ManufactureRecordTemplatePO source) {
		return BeanUtilsEx.copyProperties(source, () -> new ManufactureRecordTemplateBO(), true);
	}

	public static List<ManufactureRecordTemplateBO> toBO(Collection<SaveManufactureRecordTemplateRequest> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new ManufactureRecordTemplateBO(), true);
	}

	public static GetManufactureRecordTemplateResponse toResponse(ManufactureRecordTemplateBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new GetManufactureRecordTemplateResponse());
	}

	public static List<GetManufactureRecordTemplateResponse> toResponse(Collection<ManufactureRecordTemplateBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new GetManufactureRecordTemplateResponse());
	}

	public static ManufactureRecordTemplateQuery toQuery(ListManufactureRecordTemplateRequest source) {
		if(null == source) {
			return null;
		}
		ManufactureRecordTemplateQuery target = new ManufactureRecordTemplateQuery(source.getPageIndex(), source.getPageSize());
		BeanUtilsEx.copyProperties(source, target);
		return target;
	}

}
